import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

moveBack(context) {
  return IconButton(
    icon: Icon(
      Icons.keyboard_arrow_left,
    ),
    alignment: Alignment.center,
    onPressed: () {
      Navigator.of(context).pop();
    },
    iconSize: 60.sp,
  );
}

class RequertLoad extends StatefulWidget {
  BuildContext context;
  Future requert;
  var assembly;
  RequertLoad(this.context, this.requert, this.assembly);

  @override
  _RequertLoadState createState() =>
      _RequertLoadState(context, requert, assembly);
}

class _RequertLoadState extends State<RequertLoad> {
  BuildContext context;
  Future requert;
  var assembly;
  var data;
  _RequertLoadState(this.context, this.requert, this.assembly);
  @override
  Widget build(BuildContext context) {
    return FutureBuilder(
      future: requert,
      builder: (BuildContext context, AsyncSnapshot<dynamic> snapshot) {
        if (snapshot.hasData) {
          var data = snapshot.data;
          if (data['code'] != 200) {
            return Text('');
          }
          return assembly(data);
        }
        return Text('');
      },
    );
  }
}
